﻿using System;
using System.IO;
using SeriesUtil.SeriesClasses;
using System.Windows.Forms;
using System.Collections.Generic;

namespace SeriesUtil.SeriesClasses
{
    public class SeriesParser
    {
        private String path;
        private Boolean absolute;

        public SeriesParser(String path, Boolean absolute)
        {
            this.path = path;
            this.absolute = absolute;
        }

        /*
        public void UpdateEpisodeListView(ListView episodeListView)
        {
            Series series = new Series(path, absolute);
            episodeListView.Items.Clear();
            if (series.Absolute)
            {
                // remove column "season"
                //episodeListView.Columns.RemoveByKey("Season");
                episodeListView.Columns.RemoveAt(2);
                // iterate through the episodes
                foreach (Episode episode in series.Episodes)
                {
                    episodeListView.Items.Add(new ListViewItem(new String[4]
                    {
                        episode.Path,
                        series.Name,
                        episode.Name,
                        episode.Number
                    }));
                }
            }
            else
            {
                // add column "season"
                if(!episodeListView.Columns.ContainsKey("Season"))
                    episodeListView.Columns.Insert(2, "Season");                
                // iterate through all seasons and their episodes
                List<Season> seasons = series.Seasons;
                foreach (Season season in seasons)
                {
                    foreach (Episode episode in season.Episodes)
                    {
                        episodeListView.Items.Add(new ListViewItem(new String[5]
                        {
                            episode.Path,
                            series.Name,
                            season.Name,
                            episode.Name,
                            episode.Number
                        }));
                    }
                }
            }
        }*/
    }
}
